package com.ruoyi.active.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.active.mapper.LotteryActivityMapper;
import com.ruoyi.active.domain.LotteryActivity;
import com.ruoyi.active.service.ILotteryActivityService;

/**
 * 抽奖活动Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-01
 */
@Service
public class LotteryActivityServiceImpl implements ILotteryActivityService 
{
    @Autowired
    private LotteryActivityMapper lotteryActivityMapper;

    /**
     * 查询抽奖活动
     * 
     * @param activityId 抽奖活动主键
     * @return 抽奖活动
     */
    @Override
    public LotteryActivity selectLotteryActivityByActivityId(Long activityId)
    {
        return lotteryActivityMapper.selectLotteryActivityByActivityId(activityId);
    }

    /**
     * 查询抽奖活动列表
     * 
     * @param lotteryActivity 抽奖活动
     * @return 抽奖活动
     */
    @Override
    public List<LotteryActivity> selectLotteryActivityList(LotteryActivity lotteryActivity)
    {
        return lotteryActivityMapper.selectLotteryActivityList(lotteryActivity);
    }

    /**
     * 新增抽奖活动
     * 
     * @param lotteryActivity 抽奖活动
     * @return 结果
     */
    @Override
    public int insertLotteryActivity(LotteryActivity lotteryActivity)
    {
        lotteryActivity.setCreateTime(DateUtils.getNowDate());
        return lotteryActivityMapper.insertLotteryActivity(lotteryActivity);
    }

    /**
     * 修改抽奖活动
     * 
     * @param lotteryActivity 抽奖活动
     * @return 结果
     */
    @Override
    public int updateLotteryActivity(LotteryActivity lotteryActivity)
    {
        lotteryActivity.setUpdateTime(DateUtils.getNowDate());
        return lotteryActivityMapper.updateLotteryActivity(lotteryActivity);
    }

    /**
     * 批量删除抽奖活动
     * 
     * @param activityIds 需要删除的抽奖活动主键
     * @return 结果
     */
    @Override
    public int deleteLotteryActivityByActivityIds(Long[] activityIds)
    {
        return lotteryActivityMapper.deleteLotteryActivityByActivityIds(activityIds);
    }

    /**
     * 删除抽奖活动信息
     * 
     * @param activityId 抽奖活动主键
     * @return 结果
     */
    @Override
    public int deleteLotteryActivityByActivityId(Long activityId)
    {
        return lotteryActivityMapper.deleteLotteryActivityByActivityId(activityId);
    }
}
